package core;

public class PatternUsage {

	private final int _patternId;			//	could be either PPatern, NPatern, UPattern
	private int _numberOfTimesUsed = 0;		//	To be updated during the game, 
	private int _numberOfSuccesses = 0;		//	and to be saved in the DB at the end of the game. 
	
	
	
	public PatternUsage(int patternId) {
		_patternId = patternId;
	}
	
	public int getPatternId() {
		return _patternId;
	}
	
	public double getPatternStatistics() {
		if(_numberOfTimesUsed == 0)
			return 0;
		
		return _numberOfSuccesses / _numberOfTimesUsed;
	}
	
	public void aQuestionHasBeenAnswered(boolean correctly) {
		_numberOfTimesUsed++;
		if(correctly)
			_numberOfSuccesses++;
		
	}
	
	
}
